Skip to content

feat(modern-js-plugin-v3): port RSC bridge support into core#4467

Open
ScriptedAlchemy wants to merge 31 commits intomainfrom
feat/modernjs-rsc
Open

feat(modern-js-plugin-v3): port RSC bridge support into core#4467
ScriptedAlchemy wants to merge 31 commits intomainfrom
feat/modernjs-rsc

Conversation

@ScriptedAlchemy
Copy link
Member

Summary

  • port modernjs-v3 RSC bridge runtime support into core, including rsc-bridge-runtime-plugin, rsc-bridge-expose, and client callback bootstrap wiring
  • add async startup loader integration and guarded @modern-js/server-core/node strategy registration for compatibility with published server-core types
  • merge modern.js parity updates across config/SSR/static middleware and add RSC/contract test coverage under packages/modernjs-v3

Test plan

  • npx nx format:check
  • npx nx run modern-js-plugin-v3:test
  • npx nx run modern-js-plugin-v3:build
  • npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4
  • npx nx affected -t test --parallel=3 --exclude='*,!tag:type:pkg'
  • npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache --exclude=chrome-devtools
  • npx nx run-many --targets=build --projects=tag:type:pkg --parallel=4 --skip-nx-cache (fails on unrelated chrome-devtools:build TS2305 for @module-federation/sdk exports)

Made with Cursor

Port the modernjs-v3 RSC bridge runtime, async startup loader, and config/SSR wiring into core.
Add parity tests plus static middleware hardening for stable manifest serving and action routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2026

🦋 Changeset detected

Latest commit: a317b3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 46 packages
Name Type
@module-federation/modern-js-v3 Patch
@module-federation/sdk Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
modernjs-rsc Patch
@module-federation/devtools Patch
@module-federation/cli Patch
@module-federation/data-prefetch Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/esbuild Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/rspress-plugin Patch
@module-federation/runtime-core Patch
@module-federation/runtime Patch
@module-federation/storybook-addon Patch
@module-federation/utilities Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/runtime-tools Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/bridge-shared Patch
@module-federation/error-codes Patch
create-module-federation Patch
@module-federation/treeshake-server Patch
@module-federation/treeshake-frontend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Feb 21, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit a317b3f
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69b061be4f7f6d00081f6b4f
😎 Deploy Preview https://deploy-preview-4467--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ede7e89a78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +765 to +769
chain.resolve.conditionNames
.clear()
.add('require')
.add('import')
.add('default');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve server resolve conditions when enabling RSC

patchBundlerConfig currently clears chain.resolve.conditionNames for every server RSC build and re-adds only require/import/default. That drops existing server conditions (notably node), so packages that use conditional exports can resolve to non-Node entries in SSR (for example falling back to default/browser builds), which can break runtime behavior as soon as such a dependency is present. Keep the existing condition set and append react-server instead of resetting the list.

Useful? React with 👍 / 👎.

Comment on lines +51 to +54
runBundle(
localModule.exports,
require,
localModule,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use bundle-scoped require when executing async startup code

The VM wrapper is invoked with this module's require, not a require bound to filepath. If the async-startup bundle (or its runtime chunk loader) performs relative imports like require('./<chunk>.js'), resolution happens relative to asyncStartupLoader.ts and fails with MODULE_NOT_FOUND, causing the strategy to return undefined and leaving async-startup bundles uninitialized. Use a filepath-scoped loader (e.g. module.createRequire(filepath)) when calling runBundle.

Useful? React with 👍 / 👎.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 21, 2026

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@3631cf4

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@3631cf4

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@3631cf4

@module-federation/data-prefetch

pnpm add https://pkg.pr.new/@module-federation/data-prefetch@3631cf4

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@3631cf4

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@3631cf4

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@3631cf4

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@3631cf4

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@3631cf4

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@3631cf4

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@3631cf4

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@3631cf4

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@3631cf4

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@3631cf4

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@3631cf4

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@3631cf4

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@3631cf4

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@3631cf4

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@3631cf4

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@3631cf4

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@3631cf4

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@3631cf4

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@3631cf4

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@3631cf4

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@3631cf4

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@3631cf4

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@3631cf4

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@3631cf4

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@3631cf4

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@3631cf4

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@3631cf4

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@3631cf4

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@3631cf4

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@3631cf4

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@3631cf4

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@3631cf4

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@3631cf4

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@3631cf4

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@3631cf4

commit: 3631cf4

@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

Bundle Size Report

11 package(s) changed, 30 unchanged.

Package Total dist Delta ESM gzip Delta
modern-js-plugin-v3 395.3 kB +218.9 kB (+124.1%) 872 B no change
webpack-bundler-runtime 233.7 kB +145.2 kB (+164.0%) 494 B +89 B (+22.0%)
rspack 64.8 kB +6.2 kB (+10.6%) 211 B no change
sdk 112.7 kB +4.8 kB (+4.4%) 755 B no change
bridge-react 361.8 kB +4.2 kB (+1.2%) 1.3 kB -1 B (-0.1%)
vue3-bridge 143.1 kB +2.4 kB (+1.7%) 21.9 kB +448 B (+2.0%)
enhanced 841.0 kB +1.4 kB (+0.2%) 712 B no change
runtime-core 249.9 kB +599 B (+0.2%) 477 B no change
managers 70.4 kB +414 B (+0.6%) 334 B no change
runtime-tools 4.8 kB -39 B (-0.8%) 95 B no change
dts-plugin 297.9 kB +32 B (+0.0%) 4.3 kB +5 B (+0.1%)

Total dist: 6.75 MB (+384.2 kB (+5.9%))
Total ESM gzip: 79.7 kB (+541 B (+0.7%))

@2heal1
Copy link
Member

2heal1 commented Feb 24, 2026

Can you help add the modernjs rsc example to apps dir ?

ScriptedAlchemy and others added 13 commits February 24, 2026 11:10
Append react-server without clearing existing resolve conditions.
Use bundle-scoped require for async-startup VM execution.
Add a minimal ModernJS RSC example app under apps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Update pnpm-lock.yaml to match branch manifests.
This restores frozen-lockfile installs in CI and Netlify preview builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	pnpm-lock.yaml
Resolve the dts-plugin TYPE-001 failure by correcting package entry paths for
workspace dependencies and updating RawSource usage for webpack typings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Restore sdk and error-codes export paths to the filenames emitted by the
current build so CI package resolution no longer fails on these branches.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants